package thread.state;

import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @program: Multhread
 * @description:
 * @author: zhanghz001
 * @create: 2021-10-31 15:21
 **/
public class ThreadPoolState {
    public static void main(String[] args) {
        
        ThreadPoolExecutor poolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(5);
        poolExecutor.execute(new Runnable() {
            public void run() {
                try {
                    System.out.println("before    " + Thread.currentThread().getState());
                    Thread.sleep(5000);
                    System.out.println("after     " + Thread.currentThread().getState());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        
        // ((ThreadPoolExecutor) poolExecutor).workers.iterator().next().thread.getState();
    }
}
